﻿function noProcess($url) {
    return $url;
};

var encoder = noProcess;

var PROXY_HOST = "192.168.2.85:8100";
var ENV_MOBILE = {	
    //HOST: "http://fangzhen.unilifemedia.com:8100/service/app/v1/",
    //HOST:"http://192.168.2.124:8080/umobile/service/app/v1/",
    // HOST:"http://192.168.2.136:8080/umobile/service/app/v1/",
    //HOST:"http://192.168.2.100:8100/umobile/service/app/v1/",
    //HOST:"http://192.168.2.251:8080/umobile/service/app/v1/",
    //HOST: "http://develop.unilifemedia.com/uweb/service/v1/",
    //HOST:"http://fridge.unilifemedia.com:8100/uweb/service/v1/",
   //HOST: "http://test.unilifemedia.com/uweb/service/v1/",
   HOST: "http://mobile.unilifemedia.com/uweb/service/v1/"
};


var ENV = ENV_MOBILE;

function getImageUrl($oriUrl) {
    return $oriUrl;
}

function switch_chrome() {
    encoder = encodeURIComponent;
    var ENV_CHROME = {
        HOST: "http://" + PROXY_HOST + "/xinfei_server/index.php?url=" + encoder(ENV_MOBILE.HOST),
    };
    ENV = ENV_CHROME;
}


function switch_img_proxy() {
    getImageUrl = function ($oriUrl) {
        return "http://" + PROXY_HOST + "/xinfei_server/index.php/Home/Index/showImage?url=" + encodeURIComponent($oriUrl);
    };
}

function switch_douguo_img_address() {
    getImageUrl = function ($oriUrl) {
        if ($oriUrl) {
            return $oriUrl.replace("www.douguo.com", "cp1.douguo.net");
        }
        return $oriUrl;
    };
}
var Global = {};

// 切换到浏览器模式
switch_chrome();//部署时注释

// 切换图片代理
//switch_img_proxy();

//switch_douguo_img_address();
var ACCESS_TOKEN = "98dd30d195d568c47945f2c5d5c08c0a";
//var ACCESS_TOKEN = "8638bab4fd86297b37a07d8801ab35a1";


function resetToken($newToken) {
    ACCESS_TOKEN = $newToken;
    URLS = {
        GETTHEMLIST:ENV.HOST+encoder('poll/getThemeList?access_token='+ACCESS_TOKEN),//列表信息
        GETTHEMECOUNT:ENV.HOST+encoder('poll/savePolls?access_token='+ACCESS_TOKEN),//投票
    };
}

resetToken('');